(function() {
	jQuery.extend({
		AjaxAuthFilter : {
			cover:undefined,
			callback:undefined,
			checkSession : function(logurl,data,callback) {
				var boo = data == "nosession";
				if (boo) {
					this.removeCover();
					this.cover = $("<div class='ajax-login'></div>");
					var back = $("<div class='ajax-login-back'></div>");
					var context = $("<div class='ajax-login-context'>");
					
					var title = $("<div class='ajax-login-title' ><div class='left'>登录超时</div><div class='right'> <a href='javascript:$.AjaxAuthFilter.removeCover()'>关闭</a></div><div class='clear'></div> </div>");
					var iframe = $("<iframe src='"+logurl+"' frameborder='0' marginwidth='0' marginheight='0' scrolling='no'  class='ajax-login-iframe'>");
					context.append(title);
					context.append(iframe);
					this.cover.append(back);
					this.cover.append(context);
					$("body") .append(this.cover);
					this.callback = callback;
				}
				return !boo;
			},
			cleckOver:function(data){
				if(data){
					if(this.callback){
						this.callback(data);
					}
					this.removeCover();
				}
				 
			},
			removeCover:function(){
				if(this.cover&&this.cover.remove){
					this.cover.find("iframe").attr('src','');
					this.cover.remove();
					this.cover = undefined;
				}
			}
			
		}
	});

})(jQuery);
